package com.zb.serviceImpl;

import com.zb.mapper.AccountMapper;
import com.zb.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: 张波
 * @Time: 2025/8/20 19:05
 */
@Service
public class AccountServiceImpl implements AccountService {

	@Autowired
	private AccountMapper accountMapper;



	/**
	 *
	 * @param InId
	 * @param OutId
	 * @param money
	 * @return
	 */
	@Transactional
	@Override
	public int ExchangeTwoPersonMoney(int OutId, int InId, double money) {
		/// id为1的向id为2的转账
		if (accountMapper.updateSubMoney(OutId, money)>0 &&accountMapper.updateAddMoney(InId, money)>0) return 1;
		return 0;
	}
}
